home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_Update_JScript.asp < prev    next >
Encoding:
Text File  |  1999-07-21  |  1.5 KB  |  52 lines

  1. <%@ LANGUAGE = JScript %>
  2.  
  3. <!--METADATA TYPE="typelib" 
  4. uuid="00000205-0000-0010-8000-00AA006D2EA4" -->
  5.  
  6. <HTML>
  7.     <HEAD>
  8.         <TITLE>Update Database</TITLE>
  9.     </HEAD>
  10.  
  11.     <BODY BGCOLOR="White" topmargin="10" leftmargin="10">
  12.  
  13.         <!-- Display Header -->
  14.  
  15.         <font size="4" face="Arial, Helvetica">
  16.         <b>Update Database</b></font><br>
  17.       
  18.         <hr size="1" color="#000000">
  19.  
  20.         <%
  21.             var oConn;        // object for ADODB.Connection obj
  22.             var oRs;        // object for output recordset object
  23.             var filePath;        // Directory of authors.mdb file
  24.  
  25.             
  26.             // Map authors database to physical path
  27.             filePath = Server.MapPath("authors.mdb");
  28.  
  29.  
  30.             // Create ADO Connection Component to connect with sample database
  31.             
  32.             oConn = Server.CreateObject("ADODB.Connection");
  33.             oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +filePath);
  34.  
  35.  
  36.             // To add, delete and update  recordset, it is recommended to use 
  37.             // direct SQL statement instead of ADO methods.
  38.             oConn.Execute ( "Update Authors Set Author ='Scott Clinton' where Author='Scott Guthrie' ");
  39.             oRs = oConn.Execute ( "select * from Authors where author = 'Scott Clinton'" );
  40.         %>
  41.         
  42.         Changed Author: <%= oRs("Author") %>, <%= oRs("Yearborn") %> <P>
  43.         
  44.         <%
  45.             oConn.Execute ( "Update Authors Set Author ='Scott Guthrie' where Author='Scott Clinton' " );
  46.             oRs = oConn.Execute ( "select * from Authors where author = 'Scott Guthrie'" );        
  47.        %>
  48.         
  49.        Changed Author: <%= oRs("Author") %>, <%= oRs("Yearborn") %>            
  50.  
  51.     </BODY>
  52. </HTML>